package components;

import java.util.ArrayList;

public class Arc {

	private int line;
	private Node startNode;
	private Node endNode;
	
	private int three;
	private int four;
	private int five;
	
	private int breakCount;
	private ArrayList<Coordinate> breakCords;
	
	public Arc(){
		this.line = 0;
		this.startNode = null;
		this.endNode = null;
		
		this.three = 0;
		this.four = 0;
		this.five = 0;
		
		this.breakCount = 0;
		this.breakCords = null;
	}
	
	public Arc(int line, Node startNode, Node endNode, int three, int four, int five, int breakCount, ArrayList<Coordinate> breakCords){
		this.line = line;
		this.startNode = startNode;
		this.endNode = endNode;
		
		this.three = three;
		this.four = four;
		this.five = five;
		
		this.breakCount = breakCount;
		this.breakCords = breakCords;
	}
	
	public Arc(int line, int startNodeId, int endNodeId, int three, int five, int breakCount, ArrayList<Integer> breakCords){
		/*
		this.line = line;
		this.startNode = Node.getNode(startNode);
		this.endNode = endNode;
		
		this.three = three;
		this.four = four;
		this.five = five;
		
		this.breakCount = breakCount;
		this.breakCords = breakCords;
		*/
	}
	
	public int getLine() {
		return line;
	}

	public void setLine(int line) {
		this.line = line;
	}

	public Node getStartNode() {
		return startNode;
	}

	public void setStartNode(Node startNode) {
		this.startNode = startNode;
	}

	public Node getEndNode() {
		return endNode;
	}

	public void setEndNode(Node endNode) {
		this.endNode = endNode;
	}

	public int getThree() {
		return three;
	}

	public void setThree(int three) {
		this.three = three;
	}

	public int getFour() {
		return four;
	}

	public void setFour(int four) {
		this.four = four;
	}

	public int getFive() {
		return five;
	}

	public void setFive(int five) {
		this.five = five;
	}

	public int getBreakCount() {
		return breakCount;
	}

	public void setBreakCount(int breakCount) {
		this.breakCount = breakCount;
	}

	public ArrayList<Coordinate> getBreakCords() {
		return breakCords;
	}

	public void setBreakCords(ArrayList<Coordinate> breakCords) {
		this.breakCords = breakCords;
	}

	public void decrementLine() {
		line--;
	}
	
	public String toString(){
		return fillTo(10,""+startNode.getId())
				+fillTo(11,""+endNode.getId())
				+fillTo(11,""+three)
				+fillTo(11,""+four)
				+fillTo(11,""+five)
				+fillTo(11,""+breakCount)
				+breakCordsToString()
				;
	}
	
	private String breakCordsToString() {
		String b = "";
		for(int i=0;i<breakCount; i++){
			b += fillTo(11,""+breakCords.get(i).getLongtitude());
			b += fillTo(11,""+breakCords.get(i).getLattitude());
		}
		return null;
	}

	private String fillTo(int fills, String text){
		String f = "";
		for(int i=0; i<fills-text.length(); i++){
			f += " ";
		}
		f += text;
		return f;
	}

	
	
}
